package spil;

import desktop_resources.GUI;

public class Player {
	private int number;
	private int position;
	private int fleets;
	private int timeInJail;
	private boolean hasLost;
	private boolean jailed;
	private boolean jailCard;
	private String name;
	private Account account;
	private int camps;
	
	public Player(int number, String name) {
		this.number = number;
		this.name = name;
		position = 0;
		hasLost = false;
		jailed = false;
		account = new Account();
		fleets = 0;
		timeInJail = 0;
	}
	
	public int getNumber() {
		return number;
	}
	
	public String getName() {
		return name;
	}
	
	public int getBalance() {
		return account.getBalance();
	}
	
	public Account getAccount() {
		return account;
	}
	
	public void move(int move) {
		position += move;
		if(position > 39) {
			position %= 40;
			account.insert(200);
		}
	}
	
	public void moveToField(int position) {
		this.position = position - 1;
	}
	
	public int getPosition() {
		return position+1;
	}
	
	public void lose() {
		hasLost = true;
	}
	
	public boolean hasLost(){
		return hasLost;
	}
	
	public int getFleets(){
		return fleets;
	}
	
	public void addFleet(){
		fleets++;
	}
	
	public boolean getJailed() {
		return jailed;
	}
	
	public void jail() {
		jailed = true;
	}
	
	public void getOutOfJail() {
		jailed = false;
		timeInJail = 0;
		jailCard = false;
	}
	
	public void getOutOfJailFree() {
		jailCard = true;
	}
	
	public boolean getJailCard() {
		return jailCard;
	}
	
	public int getCamps(){
		return camps;
	}
	
	public void addCamp() {
		camps++;
	}
	
	public void jailTime() {
		timeInJail++;
	}
	
	public int getJailTime() {
		return timeInJail;
	}
	
	public String toString() {
		return name;
	}
}
